Function documentation via REPL
Function documentation via REPL
Is it possible to see the documentation for a builtin function (within MAIN context) via the REPL?
-
- Posts: 2038
- Joined: Tue Nov 29, 2005 8:28 pm
- Location: latiitude 50N longitude 3W
- Contact:
Re: Function documentation via REPL
By referring to the documentation, yes (not by crawling inside the executable :). This is a frequently-asked question, and you'll find many posts in this forum. For example, here's the first one I found. There are others, but search isn't phpbb's strong point... :)
Re: Function documentation via REPL
May I introduce my scripts command-help.lsp?
'primitives' will display the names of primitive functions.
It can use the regular expression by adding flag.
And 'syntax' will display the syntax of a primitive function.
Option flag is used for adding notes.
Addionally, if using command-event,
Option flag is available by following:
This script uses "newlisp_manual.html" in the environment variable NEWLISPDIR.
Thanks,
'primitives' will display the names of primitive functions.
Code: Select all
> (primitives "ap")
(append append-file apply)
> (primitives "file")
(file-info file?)
Code: Select all
> (primitives {file$} true)
(append-file copy-file delete-file read-file rename-file write-file)
> (primitives {\?$} true)
(NaN? array? atom? context? directory? empty? even? file? float? global? inf? integer?
lambda? legal? list? macro? nil? null? number? odd? primitive? protected? quote?
string? symbol? true? zero?)
Code: Select all
> (syntax 'struct)
struct
syntax: (struct symbol [str-data-type ... ])
""
> (syntax 'command-event true)
command-event
syntax: (command-event sym-event-handler | func-event-handler)
Specifies a user defined function for pre-processing the newLISP command-line
before it gets evaluated. This can be used to write customized interactive
newLISP shells and to transform HTTP requests when running in server mode.
""
Addionally, if using command-event,
Code: Select all
> replace
replace !
syntax: (replace exp-key list exp-replacement [func-compare])
syntax: (replace exp list)
syntax: (replace str-key str-data exp-replacement)
syntax: (replace str-pattern str-data exp-replacement int-regex-option)
>
Code: Select all
> char
char utf8
syntax: (char str [int-index [true]])
syntax: (char int)
> (syntax:set-flag true)
true
> char
char utf8
syntax: (char str [int-index [true]])
syntax: (char int)
Given a string argument, extracts the character at int-index from str,
returning either the ASCII value of that character or the Unicode value on UTF-8
enabled
versions of newLISP.
>
Thanks,
Re: Function documentation via REPL
Thank you everyone for all the answers provided.
I tried searching before i asked this question.
I tried searching before i asked this question.
-
- Posts: 2038
- Joined: Tue Nov 29, 2005 8:28 pm
- Location: latiitude 50N longitude 3W
- Contact:
Re: Function documentation via REPL
It's hard to find things on this forum sometimes...
Re: Function documentation via REPL
phpBB's search function has a lot of room for improvement! Anybody want to wrestle with their code? https://www.phpbb.com/get-involved/
Or, try this instead: At the Google search line, enter
Or, try this instead: At the Google search line, enter
or enter whatever other search term you want.search site:http://newlispfanclub.alh.net/forum/