Hi Alex,
agreed.
It was a bit of a hassle to find a nice example, but I came up with this:
# The following example calls the native Linux function 'getenv'
# in order to fetch the hostname from it (env variable = NAME).
# Then it reads user input (a guess for the hostname).
# Then it shows if it is a Soundex match or not!
: (let (InHostname (clip (in NIL (line T))) InHostnameSoundex (soundex
InHostname))
(println "InHostname:" InHostname " InHostnameSoundex:"
InHostnameSoundex)
(when (native "@" "getenv" 'S "NAME")
(let (EnvHostname @ EnvHostnameSoundex (soundex EnvHostname))
(if (= InHostnameSoundex EnvHostnameSoundex)
(println "MATCH!!!: EnvHostname:" EnvHostname
"EnvHostnameSoundex:" EnvHostnameSoundex)
(println "NO MATCH: EnvHostname:" EnvHostname
"EnvHostnameSoundex:" EnvHostnameSoundex)))))
hp-erie
"InHostname:" "hp-erie" " InHostnameSoundex:" "H160"
"MATCH!!!: EnvHostname:" "HP-Arie" "EnvHostnameSoundex:" "H160"
-> "H160"
Hope that is a sufficient example.
Best
Arie
2018-06-02 19:26 GMT+02:00 Alexander Burger <[email protected]>:
> Hi Arie,
>
> > since I notice that getpwent seems to disbehave under Windows WSL I'll
> > leave the following out if you agree:
> >
> > (let (User (clip (in NIL (line T))) Code (soundex User))
> > (while (native "@" "getpwent" '(S S I I S S S)) # 'native' only in
>
> I see. 'getpwent' is Unix-specific. On the other hand it is a pity to
> leave out
> an example just because it does not run on Windows. Perhaps you can invent
> another example for 'native'?
>
> ♪♫ Alex
>
> --
> UNSUBSCRIBE: mailto:[email protected]?subject=Unsubscribe
>